$(function () {
	var myChart = echarts.init(document.getElementById('main'));
	$.ajax({
        type:"POST",
        url:baseURL+"statement/newUserOrOrders",
        contentType: "application/json",
        success:function(res){
        	console.log(res);
        	var xObj = new Array();
        	var y1Obj = new Array();
        	var y2Obj = new Array();
        	var y3Obj = new Array();
        	for(var i=0;i<res.items.length;i++){
        		xObj[i]=res.items[i].date_str;
        		y1Obj[i]=res.items[i].add_person;
        		y2Obj[i]=res.items[i].borrow_ordes;
        		y3Obj[i]=res.items[i].deposit;
        	}
        	console.log(xObj);
        	var option = {"calculable": true,"title": {"text": "最近7天数据","x": "center"},"toolbox": {"feature": {"mark": {"show": true,"title": {"markUndo": "删除辅助线","markClear": "清空辅助线","mark": "辅助线开关"},"lineStyle": {"color": "#1e90ff","type": "dashed","width": 2}},"dataView": {"show": false,"title": "数据视图","readOnly": false,"lang": ["数据视图","关闭","刷新"]},"magicType": {"show": true,"title": {"bar": "柱形图切换","stack": "堆积","tiled": "平铺","line": "折线图切换"},"type": ["line","bar"]},"restore": {"show": true,"title": "还原"},"saveAsImage": {"show": true,"title": "保存为图片","type": "png","lang": ["点击保存"]}},"show": true},"tooltip": {"trigger": "item","formatter": "{a} <br/>{b} : {c}"},"legend": {"data": ["每日新增用户数量","每日订单数","押金缴纳人数"],"x": "left"},"xAxis": [{"type": "category","name": "x","splitLine": {"show": false},"data": xObj},{"type": "value","axisLabel": {"formatter": "{value} "}}],"yAxis": [{"type": "value"}],"series": [{"name": "每日新增用户数量","type": "line","data": y1Obj},{"name": "每日订单数","type": "line","data": y2Obj},{"name": "押金缴纳人数","type": "line","data": y3Obj}]};
        	// 为echarts对象加载数据
        	myChart.setOption(option);
        }
    });
});
